home *** CD-ROM | disk | FTP | other *** search
-
- JJ MM MM OOOO UU UU SSSSS EEEEE
- JJ MMM MMM OO OO UU UU SS EE
- JJ MM M MM OO OO UU UU SSSS EEEE
- JJ JJ MM M MM OO OO UU UU SS EE
- JJJJ MM MM OOOO UUUU SSSSS EEEEE
-
- Created by Jason Rennie for use in conjuction with TUGU.
-
- * Code copyright 1995 by Jason Rennie *
-
- This unit is a set of routines to lessen the burden on those who would
- like to use the mouse in their applications created with TUGU. It will
- only work in VGA mode 13h.
-
- May only be distributed along with the TUGU package. It may not be
- distributed separately.
-
- The following is a list of important variables used with JMOUSE:
-
- mousecx, mousecy : integer;
-
- Change in mouse position since last check. Changed every time MoveMouseA
- is called.
-
- mousex, mousey : integer;
-
- Current position of the mouse cursor on the screen.
-
- The following is a listing of the routines included in JMOUSE and a quick
- description of what they are used for:
-
- Procedure MouseStatus(Var chgx,chgy : integer; Var buttons : byte);
-
- This procedure will return the change in position of the mouse since this
- procedure has last been called. It will also return the button status
- of the mouse (bit #0 = button #1, bit #1 = button #2, etc.).
-
- buttons pressed chgx and chgy are in terms of pixels
-
- v #1 #2
- a 0 | -- | -- |
- l 1 | XX | -- |
- u 2 | -- | XX |
- e 3 | XX | XX |
-
- Procedure MoveMouseA(cursor : pointer; Var buttons : byte; backcolor : byte; Var lcursor : pointer);
- Procedure MoveMouseB(cursor : pointer; Var buttons : byte; backcolor : byte; Var lcursor : pointer);
-
- This is the heart of this unit. These two procedures provide a simple
- and automated way to control the mouse on the screen without having to
- mess with the details.
-
- "cursor" is the pointer to the image of the mouse cursor. It should be in
- the standard TUGU image format, so it is best just to draw the cursor on
- the screen and then use "getimage" to get the cursor. There is also a
- default cursor, called "cursorptr" which is automatically loaded with
- jmouse. This may be used by sending the variable "cursorptr" to "cursor".
-
- "buttons" is simply the returned button value. See above for explaination.
-
- "backcolor" is the color you do not want displayed in the mouse cursor. For
- the default cursor, this is 0. You should try values other than 0 so that
- you can see what it does. To display the mouse cursor on the screen, the
- PutTransparent routine included with TUGU is used.
-
- "lcursor" is a pointer that holds the background image of the mouse. Do
- not worry too much about this variable, just make sure you use the same
- pointer each time you call MoveMouse. "lcursor" should not be assigned
- before it is sent through MoveMouse.
-
- MoveMouseA will check to see if the mouse has been moved or any buttons
- have been pressed since last check. If so, the cursor will be cleared from
- the screen.
-
- Between MoveMouseA and MoveMouseB, you are provided with the opportunity
- to change the background according to what actions the user is performing.
- You will only be given this opportunity to change the background ONLY if
- an action is taken with the mouse (mouse is moved, button is pressed or
- released - if the buttons value remains constant, the mouse cursor is NOT
- cleared). To check whether any mouse action has been taken, you should
- compare the current "buttons" value to the last encountered and also check
- the variables which describe any change in the mouse's position. Those
- variables are "mousecx" (change in x position) and "mousecy" (change in y
- position). A sample can be seen on line #484 of Fractal.pas.
-
- MoveMouseB will get the background for later clearing the cursor and then
- replace the mouse cursor on to the screen (only if any action was taken).
-
- Procedure ResetMouse(Var cursor : pointer; Var lcursor : pointer);
-
- This procedure is used any time a major screen change is performed or any
- time you move from one mouse loop to another. This will reset the mouse
- so that it does not rely on any previous information.
-
- "cursor" is the image for the mouse cursor and "lcursor" is the pointer
- used for the background image. These must be passed to free up the memory
- previously reserved for lcursor.
-
- Procedure ChgMouseColor(cursor : pointer; c1 : byte);
-
- If you are using the standard cursor "cursorptr", you may not want the
- cursor to be color #1 (however the background will always be #0), so to
- change it, just send the cursor pointer to "cursor" and desired color to
- "c1" and it will be changed.
-
-
- NOTE: If it seems that the mouse range is limited in any program, simply move
- mouse all over the screen. This is a consequence of the desire to give
- the mouse unit the maximum detail allowable. Without this, a minor
- movement of the mouse may have shifted the on screen cursor a number of
- pixels, rather than just one.